//
//  BGMenuView.m
//  bingke
//
//  Created by zhangkt zhangkt on 12-10-15.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "BGMenuView.h"
#import "BGActivityViewController.h"
#import "BGRoadLineViewController.h"
#import "BGShoppingMallViewController.h"

@implementation BGMenuView

+ (CGRect) getFrame
{
    return CGRectMake(0, 370, 320, 90);
}

+ (CGRect) getHideFrame
{
    return CGRectMake(0, 425, 320, 90);
}

- (id) init
{
    if(self = [super init])
    {
        isMenuHide = YES;
    }
    return self;
}

- (id) hitTest: (CGPoint) point withEvent: (UIEvent *) event
{
    UIView *hitView = [super hitTest:point withEvent:event];
    
    if (hitView == self)
    {
        return nil;
    }
    else
    {
        return hitView;
    }
}

- (IBAction)hideMenu:(id)sender 
{
        [UIView beginAnimations:@"present-countdown" context:nil];
        [UIView setAnimationDuration:1];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(hideMenuAnimationStop)];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
        
        if (isMenuHide) 
        {
            self.frame = [BGMenuView getHideFrame];
        }
        else
        {
            self.frame = [BGMenuView getFrame];
        }
        isMenuHide = !isMenuHide;
        [UIView commitAnimations];
}

- (IBAction)roadLine:(id)sender 
{
//    BGRoadLineViewController *roadLineViewController = [[BGRoadLineViewController alloc] initWithNibName:@"BGRoadLineViewController" bundle:nil];
//     BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
//    [appDelegate.mainNavigationController pushViewController:roadLineViewController animated:NO];
//    [roadLineViewController release];
}

//- (IBAction)activity:(id)sender 
//{
//        BGActivityViewController *activityViewController = [[BGActivityViewController alloc] initWithNibName:@"BGActivityViewController" bundle:nil];
//        BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
//        [appDelegate.mainNavigationController pushViewController:activityViewController animated:NO];
//        [activityViewController release];
//}

- (IBAction)marketplace:(id)sender 
{
//    BGShoppingMallViewController *shoppingMallViewController = [[BGShoppingMallViewController alloc] initWithNibName:@"BGShoppingMallViewController" bundle:nil];
//    BGAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
//    [appDelegate.mainNavigationController pushViewController:shoppingMallViewController animated:NO];
//    [shoppingMallViewController release];
}

- (IBAction)assignment:(id)sender 
{
    
}

- (IBAction)account:(id)sender 
{
    
}

- (void) menuButton
{
    
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        isMenuHide = NO;
        buttonArray = [[NSMutableArray alloc] init];
    }
    return self;
}

@end
